<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateActivityImageMappingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activity_image_mappings', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger("activityId")->default(0)->comment('活动Id');
            $table->string('imageUrl', 50)->default('')->comment('活动图片');
            $table->integer("createdAt")->default(0)->unsigned()->comment("创建时间");
            $table->integer("updatedAt")->default(0)->unsigned()->comment("更新时间");
            $table->index(['activityId', 'imageUrl'], 'idx_activity_image');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '活动图片关联表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('activity_image_mappings');
    }
}
